<%@page	import="java.util.ArrayList,com.alibaba.dubbo.demo.bean.SysFunction"%>
<%@page	import="java.util.ArrayList,com.alibaba.dubbo.demo.bean.SysRole"%>
<%@page	import="com.point.community.bean.dwzPageData"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@page import="java.lang.Integer"%>
<%@page import="java.lang.String"%> 
<script src="js/buildtree.js" type="text/javascript"></script>
<script src="js/myjs.js" type="text/javascript"></script>
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%  
	String path = request.getContextPath();  
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
	String userid = request.getParameter("userid");
	String usercode = request.getParameter("usercode");
%>
<!-- <div id="userrolelist" class="unitBox" style="margin-left:703px;border-left:1px #B8D0D6 solid;"> -->
	<div class="pageHeader">
		    <form id="pagerForm" rel="pagerForm" onsubmit="return navTabSearch(this);" action="webQueryAllSysRole" method="post">
		        <input type="hidden" name="method" value="page" />
		        <div class="searchBar">
		            <table class="searchContent">
						<tr>
							<td></td>
						</tr>
					</table>
		        </div>
		    </form>
		</div>
		<div class="pageContent">
			<div class="panelBar">
		        <ul class="toolBar">
		            <li class="line"></li> 
		            <li><a class="add" ><span>角色列表:</span></a></li>
		        </ul>
		    </div>
		    <table class="table" layoutH="118">
				<thead>
					<tr>
						<th width="160">角色编码</th>
						<th width="260">角色名称</th>
					</tr>
				</thead>
				<tbody id="rolebody">
				
				</tbody>
			</table>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="button" onclick="savedata()">保存</button></div></div></li>
			</ul>
		</div>
	</div>
<script type="text/javascript">
	var userid = '<%=userid%>';
	var usercode = '<%=usercode%>';
	ajaxbuildRightRole(userid,usercode,'#rolebody');
 	function savedata()
 	{
 		var roles="";
	  	$(":checkbox:checked").each(function(){
		  var idctrl = $(this).val();
		  roles += idctrl+";";
		});
		var surl = "jsonUpdateSysUserRole?userid="+userid+"&rolelist="+roles;
		$.ajax({
        type: "post",
        contentType: "application/json",
        dataType: "json",
        timeout: 2000, //超时时间设置，单位毫秒
        url: surl,
        data: {},
        success: function(data) {
            if (data.success) {
            	alertMsg.correct('数据保存成功！');
            }
            else
            {
            	alertMsg.error('数据保存失败！');
            }
        },
        complete: function(status) { //请求完成后最终执行参数
            if (status == 'timeout') { //超时,status还有success,error等值的情况
            	console.info("savedata userrole timeout");　　
            	 alertMsg.error('数据保存超时！');　　
            }　　           
        },
        error: function( textStatus, errorThrown) {
        	console.info("savedata userrole "+textStatus);　　
        	alertMsg.error('数据保存失败！ERR:'+textStatus);　　　　　
        }
    	});
 	}
 	$("body").ready(function(){
			if(canWriteData('func00203')!=1)
			{
				$('.buttonActive').hide();
			}
		});
</script>